﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using BlueMarineWebClient.DO;

namespace BlueMarineWebClient
{
    public partial class Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadListPromotion();
        }

        protected void LoadListPromotion()
        {
            try
            {
                List<BlueMarineService.Promotion> listPromotion = ServiceBool.ExService.GetListPromotion();

                if (listPromotion.Count == 0)
                    lblResult.Text = "No Promotion";
                else
                {
                    dlPromotion.DataSource = listPromotion;
                    dlPromotion.DataBind();

                    dlPromotionList.DataSource = listPromotion.OrderByDescending(p => p.PromotionID);
                    dlPromotionList.DataBind();
                    lblResult.Text = "Load Complete";
                }
            }
            catch (Exception ex)
            {
                lblResult.Text = "ERROR" + ex.Message;
            }
        }
    }
}